/**
 * 轻弹框
 */
const showMsg = (msg)=>{
	uni.hideToast();
	uni.showToast({
	    title: msg,
		icon:'none',
	});
}
/**
 * 成功弹框
 */
const showSuccess = (msg)=>{
	uni.hideToast();
	uni.showToast({
	    title: msg,
		icon:'success',
	});
}
/**
 * 加载中
 */
const showLoading = (msg="加载中")=>{
	uni.showLoading({
	    title: msg
	});
}
/**
 * 取消加载
 */
const hideLoading = ()=>{
	 uni.hideLoading();
}
 
/**
 * 含有确定和取消的弹框
 * 返回Promise对象成功返回resolve()
 */
const showModal = (title,content,showCancel=true,cancelText="取消",confirmText="确定")=>{
	return	new	Promise((resolve,reject)=>{
		uni.showModal({
		    title,
		    content,
			showCancel,
			cancelText,
			confirmText,
		    success: function (res) {
		        if (res.confirm) {
		            resolve(1)
		        } else if (res.cancel) {
		            reject();
		        }
		    }
		});
	})	
}
 //  showAction

export default {
	showMsg,
	showSuccess,
	showLoading,
	hideLoading,
	showModal
}